#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->setWindowTitle("Qt");

    stackWidget = new QStackedWidget;
    ui->horizontalLayout->addWidget(stackWidget);
    ui->horizontalLayout->setStretch(0, 1);
    ui->horizontalLayout->setStretch(1, 10);

    //填充堆栈窗体
    envWindow = new EnvWindow;
    setWindow = new SetWindow;
    ctlWindow = new CtlWindow;
    sysWindow = new SysWindow;

    userWindow = new User;
    cardWindow = new Card;
    deviceWindow = new Device;
    historyWindow = new History;
    configWin = new configWindow;
    remoteWindow = new Remote;

    stackWidget->addWidget(envWindow);
    stackWidget->addWidget(ctlWindow);
    stackWidget->addWidget(setWindow);
    stackWidget->addWidget(sysWindow);
    stackWidget->addWidget(userWindow);
    stackWidget->addWidget(cardWindow);
    stackWidget->addWidget(deviceWindow);
    stackWidget->addWidget(historyWindow);
    stackWidget->addWidget(configWin);
    stackWidget->addWidget(remoteWindow);

//    connect(sysWindow, SIGNAL(connectSig()), this, SLOT(connectSlot()));
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_envBtn_clicked()
{
    stackWidget->setCurrentIndex(0);
}

void MainWindow::on_ctlBtn_clicked()
{
    stackWidget->setCurrentIndex(1);
}

void MainWindow::on_setBtn_clicked()
{
    stackWidget->setCurrentIndex(2);
}

void MainWindow::on_sysBtn_clicked()
{
    stackWidget->setCurrentIndex(3);
}



void MainWindow::on_userBtn_clicked()
{
    stackWidget->setCurrentIndex(4);
}
void MainWindow::on_cardBtn_clicked()
{
    stackWidget->setCurrentIndex(5);
}

void MainWindow::on_deviceBtn_clicked()
{
    stackWidget->setCurrentIndex(6);
}

void MainWindow::on_historBtn_clicked()
{
    stackWidget->setCurrentIndex(7);
}

void MainWindow::on_saveBtn_clicked()
{
    stackWidget->setCurrentIndex(8);
}

void MainWindow::on_remoteBtn_clicked()
{
   stackWidget->setCurrentIndex(9);
}
